﻿using System.Data.Common;
using System.Data.Entity;

namespace TSharp.Core.Repository.EntityFramework
{
    public class SharperDbContext : DbContext
    {
        internal SharperDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        internal SharperDbContext(DbConnection existingConnection)
            : base(existingConnection, true)
        {

        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            foreach (var part in ModelBuilderManager.StoreParts)
            {
                part.New().OnModelCreating(modelBuilder);
            }
        }
    }
}